﻿Public Class frmVuelto

    Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
        frmFacturacion.Enabled = True
        If IsNumeric(txtVuelto.Text) Then
            Dim vuelto As Double = CDbl(txtVuelto.Text)
            If vuelto < 0 Then
                Me.Hide()
                MessageBox.Show("El Monto Pago no puede ser menor al Total a Pagar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                txtPagaCon.Text = ""
                Me.Show()
            Else
                Me.Close()
            End If
        End If

    End Sub

    Private Sub txtPagaCon_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPagaCon.TextChanged
        If Not IsNumeric(txtPagaCon.Text) Then
            txtPagaCon.Text = ""
        ElseIf Not IsNumeric(txtMonto.Text) Then
            txtMonto.Text = ""
        Else
            txtVuelto.Text = CDbl(txtPagaCon.Text) - CDbl(txtMonto.Text)
        End If
    End Sub

    Private Sub frmVuelto_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        frmFacturacion.Enabled = True
    End Sub
End Class